local unitName  =  "armguard"

local unitDef  =  {
--Internal settings
    buildpic = "ARMGUARD.DDS",
    Category = "KILLABLE",
    ObjectName = "armguard.3do",
    name = "Plasma Gun",
    Side = "TANKS",
    UnitName = "armguard",
    script = "armguard.cob",
	corpse = "dead",
    
--Unit limitations and properties
    BuildTime = 1000,
    Description = "Strategical unit",
    MaxDamage = 4000,
    SightDistance = 400,
	yardmap = "ooooooooo",
	buildangle = 32700,
	airsightdistance = 1000,
	usebuildinggrounddecal = true,
	buildinggrounddecaldecayspeed = 30,
	buildinggrounddecalsizex = 5,
	buildinggrounddecalsizey = 5,
	buildinggrounddecaltype = "armguard_aoplane.dds",
	

--Energy and metal related
    BuildCostEnergy = 0,
    BuildCostMetal = 0,
	energymake = 0,
	energyuse = 0,
	
    
--Pathfinding and related
    Acceleration = 0,
    BrakeRate = 0,
    FootprintX = 3,
    FootprintZ = 3,
    MaxSlope = 10,
    MaxWaterDepth = 0,
    
--Abilities
    Builder = 0,
    CanAttack = 1,
    CanGuard = 0,
    CanMove = 0,
    CanPatrol = 0,
    CanStop = 0,
    LeaveTracks = 0,
    Reclaimable = 0,
	canSelfDestruct  = 0,	
    
--Corpse
	featuredefs = {
		dead = {
			blocking = false,
			collisionvolumetype = "Box",
			collisionvolumescales = "56.5218811035 34.070022583 54.9867858887",
			collisionvolumeoffsets = "-1.17901611328 -3.4173887085 2.49339294434",
			category = "corpses",
			damage = 999999999999,
			description = "Guardian Wreckage",
			energy = 0,
			featuredead = "HEAP",
			featurereclamate = "SMUDGE01",
			footprintx = 3,
			footprintz = 3,
			height = 40,
			hitdensity = 100,
			metal = 1069,
			object = "ARMGUARD_DEAD",
			reclaimable = false,
			seqnamereclamate = "TREE1RECLAMATE",
			world = "All Worlds",
		},
	},

	sounds = {
		canceldestruct = "cancel2",
		underattack = "warning1",
		cant = {
			[1] = "cantdo4",
		},
		count = {
			[1] = "count6",
			[2] = "count5",
			[3] = "count4",
			[4] = "count3",
			[5] = "count2",
			[6] = "count1",
		},
		ok = {
			[1] = "twrturn3",
		},
		select = {
			[1] = "twrturn3",
		},
	},

--Weapons and related
    ExplodeAs = "TANKDEATH",

	weapons = {
		[1] = {
			def = "ARMFIXED_GUN",
			maindir = "0 1 0",
			maxangledif = 230,
			BadTargetCategory = "UNKILLABLE",
			NoChaseCategory = "UNKILLABLE",
			OnlyTargetCategory = "KILLABLE",					
		},
		[2] = {
			def = "ARMFIXED_GUN_HIGH",			
			BadTargetCategory = "UNKILLABLE",
			NoChaseCategory = "UNKILLABLE",
			OnlyTargetCategory = "KILLABLE",			
		},
	},
}

local weaponDefs = {
		armfixed_gun = {
			accuracy = 75,
			areaofeffect = 128,
			craterboost = 0,
			cratermult = 0,
			edgeeffectiveness = 0.25,
			explosiongenerator = "custom:FLASH96",
			gravityaffected = "true",
			impulseboost = 0.0,
			impulsefactor = 0.0,
			name = "PlasmaCannon",
			noselfdamage = true,
			range = 450,
			reloadtime = 2.9249999523163,
			soundhit = "xplomed2",
			soundstart = "cannhvy5",
			turret = true,
			weapontype = "Cannon",
			weaponvelocity = 450,
			damage = {
				default = 300,
				unkillable = 0,
			},
		},
		armfixed_gun_high = {
			accuracy = 75,
			areaofeffect = 192,
			craterboost = 0,
			cratermult = 0,
			edgeeffectiveness = 0.5,
			explosiongenerator = "custom:FLASH96",
			gravityaffected = "true",
			impulseboost = 0.0,
			impulsefactor = 0.0,
			name = "PlasmaCannon",
			noselfdamage = true,
			proximitypriority = -2,
			range = 450,
			reloadtime = 7,
			soundhit = "xplomed2",
			soundstart = "cannhvy5",
			turret = true,
			weapontype = "Cannon",
			weaponvelocity = 440,
			damage = {
				default = 300,
				unkillable = 0,
			},
		},
	}

unitDef.weaponDefs = weaponDefs

return lowerkeys({ [unitName]  =  unitDef })